package com.hn.kiss.modules.sys.shopcommon.validdator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.text.ParseException;
import java.text.SimpleDateFormat;


/**
 * 自定义日期字符串(yyyy-MM-dd)校验注解实现
 * @author dnkj011
 *
 */
public class IsTimeValidator implements ConstraintValidator<IsTime,String>{

	@Override
	public boolean isValid(String arg0, ConstraintValidatorContext arg1) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		try {
			sdf.parse(arg0);
		} catch (ParseException e) {
			return false;
		}
		return true;
	}

}
